/*
 * @Author: szx
 * @Date: 2022-05-26 13:50:22
 * @LastEditTime: 2022-05-26 13:54:12
 * @Description:
 * @FilePath: \leetcode\面试题\10\09\09.js
 */
/**
 * @param {number[][]} matrix
 * @param {number} target
 * @return {boolean}
 */
var searchMatrix = function (matrix, target) {
    const m = matrix.length,
        n = matrix[0].length;
    let i = 0,
        j = n - 1;
    while (i < m && j >= 0) {
        if (target > matrix[i][j]) j++;
        else if (target < matrix[i][j]) i--;
        else return true;
    }
    return false;
};
